import grails.test.*

class UserAccountTests extends GrailsUnitTestCase {

  UserAccount u1, u2, u3

  protected void setUp() {
    super.setUp()
    u1 = new UserAccount(firstName: "Dale", lastName: "Manthei", email: "d@g.com", password: "pass")
    u2 = new UserAccount(firstName: "Alison", lastName: "Manthei", email: "a@g.com", password: "pass")
    u3 = new UserAccount(firstName: "Dale", lastName: "Manthei", email: "d@g.com", password: "pass")
    assertNotNull u1
    assertNotNull u2
    assertNotNull u3
  }

  protected void tearDown() {
    super.tearDown()
  }

  void testToString() {
    assertTrue u1.toString().startsWith("Manthei, Dale [")
  }

  void testEqualsTheSame() {
    assertTrue u1.equals(u3)
  }

  void testEqualsNotSame() {
    assertTrue !u1.equals(u2)
  }

  void testHash() {
    println u1.hashCode().toString()
    assertTrue u1.hashCode()!= 0
  }

}
